package main.java.indi.zyj.acm;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

public class TwoNumberSum {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = in.nextInt();
        }
        System.out.println(Arrays.toString(a));
        int target = in.nextInt();
        System.out.println(Arrays.toString(method(a, target)));
    }

    public static int[] method(int[] nums, int target) {
        int n = nums.length;
        int[] res = new int[2];
        if (nums == null || n == 0) {
            return null;
        }
        HashMap<Integer, Integer> map = new HashMap<>();
        for (int i = 0; i < n; i++) {
            int tmp = target - nums[i];
            if (map.containsKey(tmp)) {
                res[0] = i;
                res[1] = map.get(tmp);
            }
            map.put(nums[i], i);
        }
        return res;
    }
}
